﻿@model WebApp.CuisineModelView  
@{
    ViewBag.Title = "Listing des plats";
    Layout = "~/Views/Shared/_Layout_home.cshtml";
}

@section css{
    <link href="@Url.Content("~/Content/css/bootstrap-responsive.css")" rel="stylesheet">
    <link href="@Url.Content("~/Content/css/style.css")" rel="stylesheet">
    <link href="@Url.Content("~/Content/css/dropkick.css")" rel="stylesheet">

}

@section script{
    <script type="text/javascript" src="@Url.Content("~/Content/js/jquery.dropkick-1.0.0.js")"></script>
    <script src="@Url.Content("~/Content/js/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Content/js/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Content/js/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
     <script type="text/javascript" charset="utf-8">
         $(document).ready(function(){
             $("#PaymentType").change(function () {
                 var selection = $("#PaymentType").val();
                 var dataToSend = {
                     paymentType: selection
                 };

                 $.ajax({
                     url: "Order/PaymentChanged",
                     type: "GET",
                     data: dataToSend,
                     success: function (data) {
                         $("#payment").text("server returned:" + data.agent);
                     }
                 });
             });
         });

         $(function () {
             $('.cook').dropkick();
             $('.change').dropkick({
                 change: function (value, label) {
                     alert('You picked: ' + label + ':' + value);
                 }
             });

             $('.existing_event').dropkick({
                 change: function () {
                     $(this).change();
                 }
             });

             $('.custom_theme').dropkick({
                 theme: 'black',
                 change: function (value, label) {
                     $(this).dropkick('theme', value);
                 }
             });

             $('.dk_container').first().focus();
         });
  </script>

       <script type="text/javascript" charset="utf-8">
           $(function () {
               $('.bol').dropkick();
               $('.change').dropkick({
                   change: function (value, label) {
                       alert('You picked: ' + label + ':' + value);
                   }
               });

               $('.existing_event').dropkick({
                   change: function () {
                       $(this).change();
                   }
               });

               $('.custom_theme').dropkick({
                   theme: 'black',
                   change: function (value, label) {
                       $(this).dropkick('theme', value);
                   }
               });

               $('.dk_container').first().focus();
           });
  </script>

  <script>
  /* Redirection au clic */
      $(".cancel").click(function () {
          $(location).attr('href', "http://www.web.site/");
      });
  </script>

    <script>
        /* Redirection au clic */
        $(".valid").click(function () {
            $(location).attr('href', "http://www.web.site/");
        });
  </script>


}

       <div class="span12">
        <!--Body content-->
          <h1>Plats à Faire</h1>
              <table class="table table-striped">
              <thead>
                <tr>
                  <th class="table-head">Nom du plat</th>
                  <th class="table-head">Description du plat</th>
                  <th class="table-head">Type</th>
                  <th class="table-head">Etat</th>
                  <th class="table-head">Cuisinier</th>
                </tr>
              </thead>
              <tbody>
             @{int i=0;}
              @foreach (Poco.PreparationPlat plat in Model.platAttente)
              { 
                <tr>
                  <td>@plat.Plat.Nom</td>
                  <td>@plat.Plat.Description</td>
                  <td>@plat.Etat</td>
                  <td class="color">
                    <select name="state" class="bol" tabindex="2">
                      <option>en cours</option>
                      <option class="cancel">Annuler</option>
                      <option class="valid">Commande prête</option>
                    </select>
                  </td>                
                  <td class="coloration">                 
                    <select name="cook" class="cook" tabindex="2" placeholder="Cuisinier">
                    @foreach (Poco.Cuisinier cuisinier in Model.cuisiniers)
                    {
                      <option>@cuisinier.Nom @cuisinier.Prenom</option>                                       
                    }
                    </select>
                  </td>
                </tr>
              //  @{i++;}
                }
              </tbody>
              </table>          
            
            <h1>Plats finis</h1>
              <table class="table table-striped">
                <thead>
                  <tr>
                  <th class="table-head">Nom du plat</th>
                  <th class="table-head">Description du plat</th>
                  <th class="table-head">Type</th>
                  <th class="table-head">Etat</th>
                  <th class="table-head">Cuisinier</th>
                  </tr>
                </thead>
                <tbody>
               

              @foreach (Poco.PreparationPlat plat in Model.platPret)
              { 
                <tr>
                  <td class="coloration">@plat.Plat.Nom</td>
                  <td class="coloration">@plat.Plat.Description</td>
                  <td class="coloration">@plat.Etat</td>
                  <td class="coloration">prêt</td>
                  <td class="coloration">@plat.Cuisinier.Nom @plat.Cuisinier.Prenom</td>
                </tr>
               }                
                 </tbody>
              </table>

        </div>

    </div><!--/.fluid-container-->

